simple sql group by custom groups question [migrated]
Posted
by
alex
on Pro Webmasters
See other posts from Pro Webmasters
or by alex
Published on 2012-06-06T17:44:52Z
Indexed on
2012/06/06
22:48 UTC
Read the original article
Hit count: 205
imagine a mysql table that only has 2 columns, an id and a name of a color.
with this query I know how many id's do I have for each color. SELECT color_name, count(id) FROM color_table GROUP BY (color_name); red:10 blue:5 yellow:3 green:1
my question is, is there a way I can specify to the "group by" some custom groups?? i mean, is there a query that results in this??: red:10 colors different than red: 9
© Pro Webmasters or respective owner